Boolean Operators are used within expressions to join multiple conditions. The result of the expression depends on the result of the conditions and how they are joined.
An example of usage is within an If statement with multiple conditions. Each condition can be joined through the use of a boolean operator.
if (Value>10) and (MyVariable=True) will result in a true result only if both conditions evaluate to true.
if (Value>10) or (MyVariable=True) will result in a true result if one of the other conditions evaluate to true. This means either of the conditions needs to be true for the result of the If statement to be true.
If Not (Value>10)
will result in the test being reversed. That is this will evaluate to true if Value is less than 10.
xor
is hardly ever used. If you do happen to use it let me know - you will be the first!
Operator | Operation | Operand | Result | Example |
---|---|---|---|---|
not | negation | Boolean | Boolean | if not (Value > 10) then |
and | conjunction | Boolean | Boolean | if (Value>10) and (x=y) then |
or | disjunction | Boolean | Boolean | if (Value>10) or (x=y) then |
xor | exclusive disjunction | Boolean | Boolean | if (Value>10) xor (x=y) then |